# import urllib.request
# import urllib.parse
# url="https://www.baidu.com/s?wd="
# name=urllib.parse.quote("奥里给")
# url += name
# headers={
# "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36 Edg/94.0.992.38"
# }
# request=urllib.request.Request(url=url,headers=headers)
# response=urllib.request.urlopen(request)
# content=response.read().decode("utf-8")
# print(content)

#
# import urllib.request
# import urllib.parse
#
# data = {
#     "wd": "奥里给",
#     "sex": "男"
# }
# data = urllib.parse.urlencode(data)
# url = "https://www.baidu.com/s?"
# url += data
# headers = {
#     "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36 Edg/94.0.992.38"
# }
# request = urllib.request.Request(url=url, headers=headers)
# respont = urllib.request.urlopen(request)
# content = respont.read().decode("utf-8")
# print(content)


import urllib.request
import urllib.parse

url = "https://www.baidu.com/s?"
data = {
    "wd": "哈哈"
}
headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36 Edg/94.0.992.38"
}
data = urllib.parse.urlencode(data)
url += data
request = urllib.request.Request(url=url,headers=headers);
response = urllib.request.urlopen(request)
content=response.read().decode("utf-8")
print(content)

